package com.tionsy.springbootshiro.controller;

import com.tionsy.springbootshiro.common.model.Result;
import com.tionsy.springbootshiro.entity.RoleMenuEntity;
import com.tionsy.springbootshiro.service.RoleService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.apache.shiro.authz.annotation.RequiresRoles;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author tiany
 * @date 2020/10/16 16:34
 */
@Api(value = "角色接口", tags = {"角色接口"})
@RestController
@RequestMapping("/role_menu")
public class RoleMenuController {

    @Autowired
    private RoleService roleService;

    @RequiresRoles("admin")
    @PostMapping("/")
    @ApiOperation(value = "批量新增菜单", produces = "application/json")
    public Result batchInsertRoleMenu(@RequestBody List<RoleMenuEntity> roleMenus){
        return Result.build().success("新增成功",roleService.batchInsertRoleMenu(roleMenus));
    }

}

